<h2>Why is this an issue?</h2>
<p>The point of declaring an optional property or parameter is to make explicit the fact that it might contain no valid value, i.e. <code>null</code>
or <code>undefined</code>. Using a non-null assertion (the <code>!.</code> operator) will lead to a runtime error if the optional does contain
<code>null</code> or <code>undefined</code>. Even if the value is tested first, it’s still considered a bad practice to use a non-null assertion.</p>
<h3>Noncompliant code example</h3>
<pre>
function doTheThing(foo?: Foo) {
  let s = foo!.bar;  // Noncompliant
}
</pre>
<h3>Compliant solution</h3>
<pre>
function doTheThing(foo?: Foo) {
  if (foo) {
    let s = foo.bar;
  }
}
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://typescript-eslint.io/">typescript-eslint</a> - Rule <a
  href="https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-non-null-assertion.mdx">no-non-null-assertion</a> </li>
</ul>
